home *** CD-ROM | disk | FTP | other *** search
/ Whiteline: delta / whiteline CD Series - delta.iso / tools / anwender / astrolog / sources / astrolog.c < prev    next >
C/C++ Source or Header  |  1995-11-25  |  46KB  |  1,712 lines

  1. /*
  2. ** Astrolog (Version 4.40) File: astrolog.c
  3. **
  4. ** IMPORTANT NOTICE: The graphics database and chart display routines
  5. ** used in this program are Copyright (C) 1991-1995 by Walter D. Pullen
  6. ** (astara@u.washington.edu). Permission is granted to freely use and
  7. ** distribute these routines provided one doesn't sell, restrict, or
  8. ** profit from them in any way. Modification is allowed provided these
  9. ** notices remain with any altered or edited versions of the program.
  10. **
  11. ** The main planetary calculation routines used in this program have
  12. ** been Copyrighted and the core of this program is basically a
  13. ** conversion to C of the routines created by James Neely as listed in
  14. ** Michael Erlewine's 'Manual of Computer Programming for Astrologers',
  15. ** available from Matrix Software. The copyright gives us permission to
  16. ** use the routines for personal use but not to sell them or profit from
  17. ** them in any way.
  18. **
  19. ** The PostScript code within the core graphics routines are programmed
  20. ** and Copyright (C) 1992-1993 by Brian D. Willoughby
  21. ** (brianw@sounds.wa.com). Conditions are identical to those above.
  22. **
  23. ** The extended accurate ephemeris databases and formulas are from the
  24. ** calculation routines in the program "Placalc" and are programmed and
  25. ** Copyright (C) 1989,1991,1993 by Astrodienst AG and Alois Treindl
  26. ** (alois@azur.ch). The use of that source code is subject to
  27. ** regulations made by Astrodienst Zurich, and the code is not in the
  28. ** public domain. This copyright notice must not be changed or removed
  29. ** by any user of this program.
  30. **
  31. ** Initial programming 8/28,30, 9/10,13,16,20,23, 10/3,6,7, 11/7,10,21/1991.
  32. ** X Window graphics initially programmed 10/23-29/1991.
  33. ** PostScript graphics initially programmed 11/29-30/1992.
  34. ** Last code change made 1/29/1995.
  35. */
  36.  
  37. #include "astrolog.h"
  38.  
  39. /*
  40. ******************************************************************************
  41. ** Program Dispatch Procedures.
  42. ******************************************************************************
  43. */
  44.  
  45. /* Initialize the Ansi color arrays with the color to print each object in. */
  46.  
  47. void InitColors()
  48. {
  49.   int i;
  50.  
  51.   kObjA[0] = kElemA[eEar];
  52.   for (i = 1; i <= 10; i++)
  53.     kObjA[i] = kSignA(ruler1[i]);
  54.   for (i = 11; i <= 15; i++)
  55.     kObjA[i] = kMainA[8];
  56.   for (i = 16; i <= 20; i++)
  57.     kObjA[i] = kMainA[6];
  58.   for (i = 1; i <= cSign; i++)
  59.     kObjA[cuspLo+i-1] = kSignA(i);
  60.   for (i = uranLo; i <= uranHi; i++)
  61.     kObjA[i] = kRainbowA[7];
  62.   for (i = starLo; i <= starHi; i++)
  63.     kObjA[i] = starbright[i-oNorm] < 1.0 ? kRainbowA[2] : kMainA[4];
  64. }
  65.  
  66.  
  67. /* This is the dispatch procedure for the entire program. After all the   */
  68. /* command switches have been processed, this routine is called to        */
  69. /* actually call the various routines to generate and display the charts. */
  70.  
  71. void Action()
  72. {
  73.   char sz[cchSzDef];
  74.   int i;
  75.  
  76.   is.fSzPersist = fFalse;
  77.   is.cchRow = 0;
  78.   AnsiColor(kDefault);
  79.   InitColors();
  80.   if (fSouthNode) {
  81.     szObjName[oSou] = "S.Node";
  82. #ifdef INTERPRET
  83.     szMindPart[oSou] =
  84.       "karmic past, and area of experience but little growth";
  85. #endif
  86.     ruler1[oSou] = sLeo;
  87.   }
  88.   if (us.fParallel) {
  89.     szAspectAbbrev[aCon] = "Par"; szAspectAbbrev[aOpp] = "CPr";
  90.   }
  91.  
  92.   /* First let's adjust the restriction status of the cusps, uranians, and */
  93.   /* fixed stars based on whether -C, -u, and -U switches are in effect.   */
  94.  
  95.   if (!us.fCusp)
  96.     for (i = cuspLo; i <= cuspHi; i++)
  97.       ignore[i] = ignore2[i] = fTrue;
  98.   if (!us.fUranian)
  99.     for (i = uranLo; i <= uranHi; i++)
  100.       ignore[i] = ignore2[i] = fTrue;
  101.   if (!us.nStar)
  102.     for (i = starLo; i <= starHi; i++)
  103.       ignore[i] = ignore2[i] = fTrue;
  104.  
  105.   /* If the -os switch is in effect, open a file and set a global to */
  106.   /* internally 'redirect' all screen output to.                     */
  107.  
  108.   if (is.szFileScreen) {
  109.     S = fopen(is.szFileScreen, "w");
  110.     if (S == NULL) {
  111.       sprintf(sz, "File %s can not be created.", is.szFileScreen);
  112.       PrintError(sz);
  113.       S = stdout;
  114.     }
  115.   } else
  116.     S = stdout;
  117.  
  118.   if (FPrintTables())    /* Print out any generic tables specified.        */
  119.     return;              /* If nothing else to do, we can exit right away. */
  120.   if (is.fMult) {
  121.     PrintL2();
  122.     is.fMult = fFalse;
  123.   }
  124.  
  125.   /* If -+ or -- switches in effect, then add the specified delta value to */
  126.   /* the date and use that as a new date before proceeding to make chart.  */
  127.  
  128.   if (us.dayDelta != 0) {
  129.     is.JD = (real)MdyToJulian(MM, DD+us.dayDelta, YY);
  130.     JulianToMdy(is.JD, &MM, &DD, &YY);
  131.   }
  132.  
  133.   /* Here we either do a normal chart or some kind of relationship chart. */
  134.  
  135.   if (!us.nRel) {
  136.     /* If chart info not in memory yet, then prompt the user for it. */
  137.     if (!is.fHaveInfo && !FInputData(szTtyCore))
  138.       return;
  139.     CastChart(fTrue);
  140.     ciMain = ciCore;
  141.   } else
  142.     CastRelation(fTrue);
  143.   ciSave = ciMain;
  144.  
  145. #ifdef GRAPH
  146.   if (us.fGraphics)         /* If any of the X window switches in effect, */
  147.     FActionX();             /* then go make a graphics chart...           */
  148.   else
  149. #endif
  150.     PrintChart(is.fProgress);    /* Otherwise print chart on text screen. */
  151.  
  152.   if (us.fWriteFile)        /* If -o switch in effect, then write */
  153.     FOutputData();          /* the chart information to a file.   */
  154.  
  155.   if (S != stdout)    /* If we were internally directing chart display to a */
  156.     fclose(S);        /* file as with the -os switch, close it here.        */
  157.  
  158.   if (grid)
  159.     DeallocateFar(grid);
  160. }
  161.  
  162.  
  163. /* Reset a few variables to their default values they have upon startup of */
  164. /* the program. We don't reset all variables, just the most volatile ones. */
  165. /* This is called when in the -Q loop to reset things like which charts to */
  166. /* display, but leave setups such as object restrictions and orbs alone.   */
  167.  
  168. void InitVariables()
  169. {
  170.   us.fInterpret = us.fProgress = is.fHaveInfo = is.fMult = fFalse;
  171.   us.nRel = us.dayDelta = 0;
  172.   is.szFileScreen = NULL;
  173.   ClearB((lpbyte)&us.fListing,
  174.     (int)((lpbyte)&us.fLoop - (lpbyte)&us.fListing));
  175. }
  176.  
  177.  
  178. /*
  179. ******************************************************************************
  180. ** Command Switch Procedures.
  181. ******************************************************************************
  182. */
  183.  
  184. /* Given a string representing a command line (e.g. a macro string), go    */
  185. /* parse it into its various switches and parameters, then go process them */
  186. /* and change program settings. Basically a wrapper for other functions.   */
  187.  
  188. bool FProcessCommandLine(szLine)
  189. char *szLine;
  190. {
  191.   char szCommandLine[cchSzMax], *rgsz[MAXSWITCHES];
  192.   int argc, cb, fT;
  193.  
  194.   if (szLine == NULL)
  195.     return fTrue;
  196.   if (Mon != -1)
  197.     ciCore = ciMain;
  198.   cb = CchSz(szLine)+1;
  199.   CopyRgb((byte *)szLine, (byte *)szCommandLine, cb);
  200.   argc = NParseCommandLine(szCommandLine, rgsz);
  201.   fT = FProcessSwitches(argc, rgsz);
  202.   ciMain = ciCore;
  203.   return fT;
  204. }
  205.  
  206.  
  207. /* Given string representing a command line, convert it to an "argv" format */
  208. /* of an array of strings, one for each switch or parameter, i.e. exactly   */
  209. /* like the format of the command line as given when the program starts.    */
  210.  
  211. int NParseCommandLine(szLine, argv)
  212. char *szLine;
  213. char **argv;
  214. {
  215.   int argc = 1, fSpace = fTrue, fQuote = fFalse;
  216.   char *pch = szLine;
  217.  
  218.   /* Split the entered line up into its individual switch strings. */
  219.   while (*pch >= ' ' || *pch == chTab) {
  220.     if (*pch == ' ' || *pch == chTab) {
  221.       if (fSpace)
  222.         /* Skip over the current run of spaces between strings. */
  223.         ;
  224.       else {
  225.         /* First space after a string, end parameter here. */
  226.         if (!fQuote) {
  227.           *pch = chNull;
  228.           fSpace = fTrue;
  229.         }
  230.       }
  231.     } else {
  232.       if (fSpace) {
  233.         /* First character after run of spaces, begin parameter here. */
  234.         if (argc >= MAXSWITCHES-1) {
  235.           PrintWarning("Too many items - rest of line ignored.");
  236.           break;
  237.         }
  238.         fQuote = (*pch == '"');
  239.         argv[argc++] = pch + fQuote;
  240.         fSpace = fFalse;
  241.       } else
  242.         /* Skip over the current string. */
  243.         if (fQuote && *pch == '"') {
  244.           *pch = chNull;
  245.           fSpace = fTrue;
  246.         }
  247.     }
  248.     pch++;
  249.   }
  250.   argv[0] = szAppNameCore;
  251.   argv[argc] = NULL;         /* Set last string in switch array to Null. */
  252.   return argc;
  253. }
  254.  
  255.  
  256. /* This routine is called by the main program to interactively prompt the  */
  257. /* user for command switches and parameters, entered in the same format as */
  258. /* they would be on a command line. This needs to be called with certain   */
  259. /* systems which don't allow passing of a command line to the program,     */
  260. /* or when -Q is in effect. The result of this routine is returned to the  */
  261. /* main program which then processes it as done with a real command line.  */
  262.  
  263. int NPromptSwitches(line, argv)
  264. char *line, *argv[MAXSWITCHES];
  265. {
  266.   FILE *data;
  267.   char sz[cchSzDef];
  268.  
  269.   data = S; S = stdout;
  270.   is.cchRow = 0;
  271.   AnsiColor(kWhite);
  272.   sprintf(sz, "** %s version %s ", szAppName, szVersionCore); PrintSz(sz);
  273.   sprintf(sz, "(See '%cHc' switch for copyrights and credits.) **\n",
  274.     chSwitch); PrintSz(sz);
  275.   AnsiColor(kDefault);
  276.   PrintSz("Enter all parameter options below. ");
  277.   sprintf(sz, "(Enter '%cH' for help. Enter '.' to exit.)\n", chSwitch);
  278.   PrintSz(sz);
  279.   S = data;
  280.   InputString("Input command line", line);
  281.   PrintL();
  282.   return NParseCommandLine(line, argv);
  283. }
  284.  
  285.  
  286. /* This subprocedure is like FProcessSwitches() below, except that we only */
  287. /* process one switch, which we know to be one of the obscure -Y types.    */
  288.  
  289. int NProcessSwitchesRare(argc, argv, pos, fOr, fAnd, fNot)
  290. int argc, pos;
  291. bool fOr, fAnd, fNot;
  292. char **argv;
  293. {
  294.   int darg = 0, i, j, k;
  295.   real r;
  296.   char ch1, ch2;
  297.   OE oe;
  298.   lpbyte lpb;
  299.   int FAR *lpn;
  300.   lpreal lpr;
  301. #ifdef INTERPRET
  302.   char *sz;
  303. #endif
  304.  
  305.   ch1 = argv[0][pos+1]; ch2 = argv[0][pos+2];
  306.   switch (argv[0][pos]) {
  307.   case chNull:
  308.     SwitchF(us.fSwitchRare);
  309.     break;
  310.  
  311.   case 'n':
  312.     SwitchF(us.fTrueNode);
  313.     break;
  314.  
  315.   case 'd':
  316.     SwitchF(us.fEuroDate);
  317.     break;
  318.  
  319.   case 't':
  320.     SwitchF(us.fEuroTime);
  321.     break;
  322.  
  323.   case 'C':
  324.     SwitchF(us.fSmartCusp);
  325.     break;
  326.  
  327.   case '8':
  328.     SwitchF(us.fClip80);
  329.     break;
  330.  
  331.   case 'Q':
  332.     if (argc <= 1) {
  333.       ErrorArgc("YQ");
  334.       return tcError;
  335.     }
  336.     i = atoi(argv[1]);
  337.     if (i < 0) {
  338.       ErrorValN("YQ", i);
  339.       return tcError;
  340.     }
  341.     us.nScrollRow = i;
  342.     darg++;
  343.     break;
  344.  
  345.   case 'o':
  346.     SwitchF(us.fWriteOld);
  347.     break;
  348.  
  349. #ifdef ARABIC
  350.   case 'P':
  351.     if (argc <= 1) {
  352.       ErrorArgc("YP");
  353.       return tcError;
  354.     }
  355.     i = atoi(argv[1]);
  356.     if (!FBetween(i, -1, 1)) {
  357.       ErrorValN("YP", i);
  358.       return tcError;
  359.     }
  360.     us.nArabicNight = i;
  361.     darg++;
  362.     break;
  363. #endif
  364.  
  365.   case 'E':
  366.     if (argc <= 17) {
  367.       ErrorArgc("YE");
  368.       return tcError;
  369.     }
  370.     i = NParseSz(argv[1], pmObject);
  371.     if (!FHelio(i)) {
  372.       ErrorValN("YE", i);
  373.       return tcError;
  374.     }
  375.     oe.sma = atof(argv[2]);
  376.     oe.ec0 = atof(argv[3]);  oe.ec1 = atof(argv[4]);  oe.ec2 = atof(argv[5]);
  377.     oe.in0 = atof(argv[6]);  oe.in1 = atof(argv[7]);  oe.in2 = atof(argv[8]);
  378.     oe.ap0 = atof(argv[9]);  oe.ap1 = atof(argv[10]); oe.ap2 = atof(argv[11]);
  379.     oe.an0 = atof(argv[12]); oe.an1 = atof(argv[13]); oe.an2 = atof(argv[14]);
  380.     oe.ma0 = atof(argv[15]); oe.ma1 = atof(argv[16]); oe.ma2 = atof(argv[17]);
  381.     rgoe[IoeFromObj(i)] = oe;
  382.     darg += 17;
  383.     break;
  384.  
  385.   case 'R':
  386.     if (argc <= 2) {
  387.       ErrorArgc("YR");
  388.       return tcError;
  389.     }
  390.     i = NParseSz(argv[1], pmObject); j = NParseSz(argv[2], pmObject);
  391.     if (ch1 == '0') {
  392.       ignore[0]  = i != 0;
  393.       ignore2[0] = j != 0;
  394.       darg += 2;
  395.       break;
  396.     }
  397.     if (!FItem(i)) {
  398.       ErrorValN("YR", i);
  399.       return tcError;
  400.     }
  401.     if (!FItem(j) || j < i) {
  402.       ErrorValN("YR", j);
  403.       return tcError;
  404.     }
  405.     if (argc <= 3+j-i) {
  406.       ErrorArgc("YR");
  407.       return tcError;
  408.     }
  409.     lpb = ch1 == 'T' ? ignore2 : ignore;
  410.     for (k = i; k <= j; k++)
  411.       lpb[k] = atoi(argv[3+k-i]) != 0;
  412.     darg += 3+j-i;
  413.     break;
  414.  
  415.   case 'A':
  416.     if (argc <= 2) {
  417.       ErrorArgc("YA");
  418.       return tcError;
  419.     }
  420.     k = ch1 == 'm' || ch1 == 'd' ? pmObject : pmAspect;
  421.     i = NParseSz(argv[1], k); j = NParseSz(argv[2], k);
  422.     k = ch1 == 'm' || ch1 == 'd' ? cObj : cAspect;
  423.     if (!FBetween(i, 1, k)) {
  424.       ErrorValN("YA", i);
  425.       return tcError;
  426.     }
  427.     if (!FBetween(j, 1, k) || j < i) {
  428.       ErrorValN("YA", j);
  429.       return tcError;
  430.     }
  431.     if (argc <= 3+j-i) {
  432.       ErrorArgc("YA");
  433.       return tcError;
  434.     }
  435.     lpr = ch1 == 'm' ? planetorb : (ch1 == 'd' ? planetadd : aspectorb);
  436.     for (k = i; k <= j; k++)
  437.       lpr[k] = atof(argv[3+k-i]);
  438.     darg += 3+j-i;
  439.     break;
  440.  
  441.   case 'j':
  442.     if (argc <= 2 + 2*(ch1 == '0')) {
  443.       ErrorArgc("Yj");
  444.       return tcError;
  445.     }
  446.     if (ch1 == '0') {
  447.       objectinf[oNorm+1] = atof(argv[1]);
  448.       objectinf[oNorm+2] = atof(argv[2]);
  449.       houseinf[cSign+1]  = atof(argv[3]);
  450.       houseinf[cSign+2]  = atof(argv[4]);
  451.       darg += 4;
  452.       break;
  453.     }
  454.     k = ch1 == 'C' ? pmSign : (ch1 == 'A' ? pmAspect : pmObject);
  455.     i = NParseSz(argv[1], k); j = NParseSz(argv[2], k);
  456.     k = ch1 == 'C' ? cSign : (ch1 == 'A' ? cAspect : cObj);
  457.     if (!FBetween(i, 1, k)) {
  458.       ErrorValN("Yj", i);
  459.       return tcError;
  460.     }
  461.     if (!FBetween(j, 1, k) || j < i) {
  462.       ErrorValN("Yj", j);
  463.       return tcError;
  464.     }
  465.     if (argc <= 3+j-i) {
  466.       ErrorArgc("Yj");
  467.       return tcError;
  468.     }
  469.     lpr = ch1 == 'C' ? houseinf : (ch1 == 'A' ? aspectinf :
  470.       (ch1 == 'T' ? transitinf : objectinf));
  471.     for (k = i; k <= j; k++)
  472.       lpr[k] = atof(argv[3+k-i]);
  473.     darg += 3+j-i;
  474.     break;
  475.  
  476. #ifdef INTERPRET
  477.   case 'I':
  478.     if (argc <= 2) {
  479.       ErrorArgc("YI");
  480.       return tcError;
  481.     }
  482.     i = NParseSz(argv[1],
  483.       ch1 == 'A' ? pmAspect : (ch1 == chNull ? pmObject : pmSign));
  484.     j = ch1 == 'A' ? cAspect : (ch1 == chNull ? oNorm : cSign);
  485.     if (!FBetween(i, 1, j)) {
  486.       ErrorValN("YI", i);
  487.       return tcError;
  488.     }
  489.     if (ch1 == 'A' && ch2 == '0')
  490.       ch1 = '0';
  491.     sz = SzPersist(argv[2]);
  492.     switch (ch1) {
  493.     case 'A':    szInteract[i]  = sz; break;
  494.     case '0':    szTherefore[i] = sz; break;
  495.     case chNull: szMindPart[i]  = sz; break;
  496.     case 'C':    szLifeArea[i]  = sz; break;
  497.     case 'v':    szDesire[i]    = sz; break;
  498.     default:     szDesc[i]      = sz;
  499.     }
  500.     darg += 2;
  501.     break;
  502. #endif
  503.  
  504.   case 'k':
  505.     if (argc <= 2 + 2*(ch1 == 'C')) {
  506.       ErrorArgc("Yk");
  507.       return tcError;
  508.     }
  509.     if (ch1 == 'C') {
  510.       kElemA[eFir] = NParseSz(argv[1], pmColor) & 15;
  511.       kElemA[eEar] = NParseSz(argv[2], pmColor) & 15;
  512.       kElemA[eAir] = NParseSz(argv[3], pmColor) & 15;
  513.       kElemA[eWat] = NParseSz(argv[4], pmColor) & 15;
  514.       darg += 4;
  515.       break;
  516.     }
  517.     k = ch1 == 'A' ? pmAspect : 0;
  518.     i = NParseSz(argv[1], k); j = NParseSz(argv[2], k);
  519.     k = ch1 == 'A' ? cAspect : (ch1 == '0' ? 7 : 8);
  520.     if (!FBetween(i, ch1 != chNull, k)) {
  521.       ErrorValN("Yk", i);
  522.       return tcError;
  523.     }
  524.     if (!FBetween(j, ch1 != chNull, k) || j < i) {
  525.       ErrorValN("Yk", j);
  526.       return tcError;
  527.     }
  528.     if (argc <= 3+j-i) {
  529.       ErrorArgc("Yk");
  530.       return tcError;
  531.     }
  532.     lpn = ch1 == 'A' ? kAspA : (ch1 == '0' ? kRainbowA : kMainA);
  533.     for (k = i; k <= j; k++)
  534.       lpn[k] = NParseSz(argv[3+k-i], pmColor) & 15;
  535.     darg += 3+j-i;
  536.     break;
  537.  
  538.   case 'F':
  539.     if (argc <= 8) {
  540.       ErrorArgc("YF");
  541.       return tcError;
  542.     }
  543.     i = NParseSz(argv[1], pmObject);
  544.     if (!FItem(i)) {
  545.       ErrorValN("YF", i);
  546.       return tcError;
  547.     }
  548.     r = Mod((real)(atoi(argv[2]) +
  549.       (NParseSz(argv[3], pmSign)-1)*30) + atof(argv[4])/60.0);
  550.     if (!FCusp(i))
  551.       planet[i] = r;
  552.     else {
  553.       j = Mod12(i-(cuspLo-1)+6);
  554.       if (FBetween(i, cuspLo-1+4, cuspLo-1+9)) {
  555.         house[i-(cuspLo-1)] = r;
  556.         house[j] = Mod(r + rDegHalf);
  557.       } else {
  558.         planet[i] = r;
  559.         planet[cuspLo-1+j] = Mod(r + rDegHalf);
  560.       }
  561.     }
  562.     j = atoi(argv[5]);
  563.     r = (j < 0 ? -1.0 : 1.0)*((real)abs(j) + atof(argv[6])/60.0);
  564.     planetalt[i] = Mod((r + rDegQuad) * 2.0) / 2.0 - rDegQuad;
  565.     ret[i] = RFromD(atof(argv[7]));
  566.     if (i <= oNorm)
  567.       SphToRec(atof(argv[8]), planet[i], planetalt[i],
  568.         &spacex[i], &spacey[i], &spacez[i]);
  569.     MM = -1;
  570.     darg += 8;
  571.     break;
  572.  
  573. #ifdef GRAPH
  574.   case 'X':
  575.     return NProcessSwitchesRareX(argc, argv, pos+1);
  576. #endif
  577.  
  578.   default:
  579.     ErrorSwitch(argv[0]);
  580.     return tcError;
  581.   }
  582.   return darg;    /* Return the value to be added to argc. */
  583. }
  584.  
  585.  
  586. /* Process a command switch line passed to the program. Read each entry in */
  587. /* the argument list and set all the program modes and charts to display.  */
  588.  
  589. bool FProcessSwitches(argc, argv)
  590. int argc;
  591. char **argv;
  592. {
  593.   int ich, i, j;
  594.   bool fNot, fOr, fAnd;
  595.   real rT;
  596.   char ch1, ch2, *pch;
  597.  
  598.   argc--; argv++;
  599.   while (argc) {
  600.     ch1 = argv[0][0];
  601.     fNot = fOr = fAnd = fFalse;
  602.     switch (ch1) {
  603.     case '=': fOr  = fTrue; break;
  604.     case '_': fAnd = fTrue; break;
  605.     case ':':               break;
  606.     default:  fNot = fTrue; break;
  607.     }
  608.     ich = 1 + FChSwitch(argv[0][0]);    /* Leading dash? */
  609.     ch1 = argv[0][ich];
  610.     ch2 = ch1 == chNull ? chNull : argv[0][ich+1];
  611.     switch (argv[0][ich-1]) {
  612.  
  613.     case 'H':
  614.       if (ch1 == 'c')
  615.         SwitchF(us.fCredit);
  616.       else if (ch1 == 'Y')
  617.         SwitchF(us.fSwitchRare);
  618. #ifdef ISG
  619.       else if (ch1 == 'X')
  620.         SwitchF(us.fKeyGraph);
  621. #endif
  622.       else if (ch1 == 'C')
  623.         SwitchF(us.fSign);
  624.       else if (ch1 == 'O')
  625.         SwitchF(us.fObject);
  626.       else if (ch1 == 'A')
  627.         SwitchF(us.fAspect);
  628.       else if (ch1 == 'F')
  629.         SwitchF(us.fConstel);
  630.       else if (ch1 == 'S')
  631.         SwitchF(us.fOrbitData);
  632.       else if (ch1 == 'I')
  633.         SwitchF(us.fMeaning);
  634.       else if (ch1 == 'e') {
  635.         SwitchF(us.fCredit); SwitchF(us.fSwitch); SwitchF(us.fSwitchRare);
  636.         SwitchF(us.fKeyGraph); SwitchF(us.fSign); SwitchF(us.fObject);
  637.         SwitchF(us.fAspect); SwitchF(us.fConstel); SwitchF(us.fOrbitData);
  638.         SwitchF(us.fMeaning);
  639.       } else
  640.         SwitchF(us.fSwitch);
  641.       break;
  642.  
  643.     case 'Q':
  644.       if (ch1 == '0')
  645.         SwitchF(us.fLoopInit);
  646.       SwitchF(us.fLoop);
  647.       break;
  648.  
  649.     case 'M':
  650.       i = (ch1 == '0');
  651.       if (argc <= 1+i) {
  652.         ErrorArgc("M");
  653.         return fFalse;
  654.       }
  655.       j = atoi(argv[1]);
  656.       if (!FValidMacro(j)) {
  657.         ErrorValN("M", j);
  658.         return fFalse;
  659.       }
  660.       j--;
  661.       if (i)
  662.         szMacro[j] = SzPersist(argv[2]);
  663.       else
  664.         FProcessCommandLine(szMacro[j]);
  665.       argc -= 1+i; argv += 1+i;
  666.       break;
  667.  
  668.     case 'Y':
  669.       i = NProcessSwitchesRare(argc, argv, ich, fOr, fAnd, fNot);
  670.       if (i < 0)
  671.         return fFalse;
  672.       argc -= i; argv += i;
  673.       break;
  674.  
  675.     /* Switches which determine the type of chart to display: */
  676.  
  677.     case 'v':
  678.       if (ch1 == '0')
  679.         SwitchF(us.fVelocity);
  680.       SwitchF(us.fListing);
  681.       break;
  682.  
  683.     case 'w':
  684.       if (ch1 == '0')
  685.         SwitchF(us.fWheelReverse);
  686.       if (argc > 1 && (i = atoi(argv[1]))) {
  687.         argc--; argv++;
  688.         if (!FValidWheel(i)) {
  689.           ErrorValN("w", i);
  690.           return fFalse;
  691.         }
  692.         us.nWheelRows = i;
  693.       }
  694.       SwitchF(us.fWheel);
  695.       break;
  696.  
  697.     case 'g':
  698.       if (ch1 == '0' || ch2 == '0')
  699.         SwitchF(us.fGridConfig);
  700.       if (ch1 == 'a')
  701.         SwitchF(us.fAppSep);
  702.       else if (ch1 == 'p')
  703.         SwitchF(us.fParallel);
  704. #ifdef X11
  705.       else if (ch1 == 'e') {
  706.         if (argc <= 1) {
  707.           ErrorArgc("geometry");
  708.           return fFalse;
  709.         }
  710.         gs.xWin = atoi(argv[1]);
  711.         if (argc > 2 && (gs.yWin = atoi(argv[2]))) {
  712.           argc--; argv++;
  713.         } else
  714.           gs.yWin = gs.xWin;
  715.         if (!FValidGraphx(gs.xWin)) {
  716.           ErrorValN("geometry", gs.xWin);
  717.           return fFalse;
  718.         }
  719.         if (!FValidGraphy(gs.yWin)) {
  720.           ErrorValN("geometry", gs.yWin);
  721.           return fFalse;
  722.         }
  723.         argc--; argv++;
  724.         break;
  725.       }
  726. #endif
  727.       SwitchF(us.fGrid);
  728.       break;
  729.  
  730.     case 'a':
  731.       SwitchF(us.fAspList);
  732.       if (ch1 == '0') {
  733.         SwitchF(us.fAspSummary);
  734.         ch1 = ch2;
  735.       }
  736.       if (ch1 == 'a')
  737.         SwitchF(us.fAppSep);
  738.       else if (ch1 == 'p')
  739.         SwitchF(us.fParallel);
  740.       break;
  741.  
  742.     case 'm':
  743.       if (ch1 == '0')
  744.         SwitchF(us.fMidSummary);
  745.       SwitchF(us.fMidpoint);
  746.       break;
  747.  
  748.     case 'Z':
  749.       if (ch1 == '0')
  750.         SwitchF(us.fPrimeVert);
  751.       else if (ch1 == 'd')
  752.         SwitchF(us.fHorizonSearch);
  753.       SwitchF(us.fHorizon);
  754.       break;
  755.  
  756.     case 'S':
  757.       SwitchF(us.fOrbit);
  758.       break;
  759.  
  760.     case 'j':
  761.       if (ch1 == '0')
  762.         SwitchF(us.fInfluenceSign);
  763.       SwitchF(us.fInfluence);
  764.       break;
  765.  
  766.     case 'L':
  767.       if (ch1 == '0')
  768.         SwitchF(us.fLatitudeCross);
  769.       if (argc > 1 && (i = atoi(argv[1]))) {
  770.         argc--; argv++;
  771.         if (i < 1 || 160%i > 0) {
  772.           ErrorValN("L", i);
  773.           return fFalse;
  774.         }
  775.         us.nAstroGraphStep = i;
  776.       }
  777.       SwitchF(us.fAstroGraph);
  778.       break;
  779.  
  780.     case 'K':
  781.       if (ch1 == 'y')
  782.         SwitchF(us.fCalendarYear);
  783.       SwitchF(us.fCalendar);
  784.       break;
  785.  
  786.     case 'd':
  787.       if (ch1 == 'p') {
  788.         i = (ch2 == 'y') + 2*(ch2 == 'Y');
  789. #ifdef TIME
  790.         j = i < 2 && (argv[0][ich+i+1] == 'n');
  791. #else
  792.         j = fFalse;
  793. #endif
  794.         if (!j && argc <= 2-(i&1)) {
  795.           ErrorArgc("dp");
  796.           return fFalse;
  797.         }
  798.         is.fProgress = us.fInDayMonth = fTrue;
  799.         Dst2 = us.dstDef; Zon2 = us.zonDef;
  800.         Lon2 = us.lonDef; Lat2 = us.latDef;
  801. #ifdef TIME
  802.         if (j)
  803.           GetTimeNow(&Mon2, &Day2, &Yea2, &Tim2, Zon2-Dst2);
  804. #endif
  805.         if (i) {
  806.           Mon2 = 0;
  807.           if (!j)
  808.             Yea2 = NParseSz(argv[1], pmYea);
  809.           us.nEphemYears = i == 2 ? atoi(argv[2]) : 1;
  810.         } else {
  811.           if (!j) {
  812.             Mon2 = NParseSz(argv[1], pmMon);
  813.             Yea2 = NParseSz(argv[2], pmYea);
  814.             if (!FValidMon(Mon2)) {
  815.               ErrorValN("dp", Mon2);
  816.               return fFalse;
  817.             }
  818.           }
  819.         }
  820.         if (!FValidYea(Yea2)) {
  821.           ErrorValN("dp", Yea2);
  822.           return fFalse;
  823.         }
  824.         if (!j) {
  825.           i = 2-(i&1);
  826.           argc -= i; argv += i;
  827.         }
  828.       } else if (ch1 == 'm' || ch1 == 'y' || ch1 == 'Y') {
  829.         if (ch1 == 'y')
  830.           us.nEphemYears = 1;
  831.         else if (ch1 == 'Y') {
  832.           if (argc <= 1) {
  833.             ErrorArgc("dY");
  834.             return fFalse;
  835.           }
  836.           i = atoi(argv[1]);
  837.           if (i < 1) {
  838.             ErrorValN("dY", i);
  839.             return fFalse;
  840.           }
  841.           us.nEphemYears = i;
  842.         }
  843.         SwitchF(us.fInDayMonth);
  844.         Mon2 = (ch1 == 'm');
  845.       }
  846. #ifdef X11
  847.       else if (ch1 == 'i') {    /* -display switch for X */
  848.         if (argc <= 1) {
  849.           ErrorArgc("display");
  850.           return fFalse;
  851.         }
  852.         gs.szDisplay = SzPersist(argv[1]);
  853.         argc--; argv++;
  854.         break;
  855.       }
  856. #endif
  857.       else if (argc > 1 && (i = atoi(argv[1]))) {
  858.         if (!FValidDivision(i)) {
  859.           ErrorValN("d", i);
  860.           return fFalse;
  861.         }
  862.         us.nDivision = i;
  863.         argc--; argv++;
  864.       }
  865.       SwitchF(us.fInDay);
  866.       break;
  867.  
  868.     case 'D':
  869.       SwitchF(us.fInDayInf);
  870.       break;
  871.  
  872.     case 'E':
  873.       if (ch1 == 'Y' && argc <= 1) {
  874.         ErrorArgc("E");
  875.         return fFalse;
  876.       }
  877.       SwitchF(us.fEphemeris);
  878.       if (ch1 == 'y')
  879.         us.nEphemYears = us.fEphemeris ? 1 : 0;
  880.       else if (ch1 == 'Y') {
  881.         i = atoi(argv[1]);
  882.         if (i < 1) {
  883.           ErrorValN("EY", i);
  884.           return fFalse;
  885.         }
  886.         us.nEphemYears = i;
  887.       }
  888.       break;
  889.  
  890.     case 'e':
  891.       SwitchF(us.fListing); SwitchF(us.fWheel);
  892.       SwitchF(us.fGrid); SwitchF(us.fAspList); SwitchF(us.fMidpoint);
  893.       SwitchF(us.fHorizon); SwitchF(us.fOrbit);
  894.       SwitchF(us.fAstroGraph); SwitchF(us.fInfluence); SwitchF(us.fCalendar);
  895.       SwitchF(us.fInDay); SwitchF(us.fInDayInf);
  896.       SwitchF(us.fEphemeris);
  897.       SwitchF(us.fGridConfig); SwitchF(us.fInfluenceSign);
  898.       SwitchF(us.fLatitudeCross);
  899.       break;
  900.  
  901.     case 't':
  902.       SwitchF(us.fTransit);
  903.       Zon2 = us.zonDef; Dst2 = us.dstDef; Lon2 = us.lonDef; Lat2 = us.latDef;
  904.       if (ch1 == 'p') {
  905.         is.fProgress = fTrue;
  906.         ch1 = argv[0][++ich];
  907.       }
  908.       if (i = (ch1 == 'y') + 2*(ch1 == 'Y'))
  909.         ch1 = argv[0][++ich];
  910. #ifdef TIME
  911.       if (ch1 == 'n') {
  912.         GetTimeNow(&Mon2, &Day2, &Yea2, &Tim2, Zon2-Dst2);
  913.         if (i == 1)
  914.           Mon2 = 0;
  915.         else if (i > 1) {
  916.           Mon2 = -1; Day2 = NParseSz(argv[1], pmDay);
  917.         }
  918.         break;
  919.       }
  920. #endif
  921.       if (argc <= 2 - (i & 1)) {
  922.         ErrorArgc("t");
  923.         return fFalse;
  924.       }
  925.       if (i) {
  926.         if (i == 1)
  927.           Mon2 = 0;
  928.         else {
  929.           Mon2 = -1; Day2 = NParseSz(argv[2], pmDay);
  930.         }
  931.       } else {
  932.         Mon2 = NParseSz(argv[1], pmMon);
  933.         if (!FValidMon(Mon2)) {
  934.           ErrorValN("t", Mon2);
  935.           return fFalse;
  936.         }
  937.       }
  938.       Yea2 = NParseSz(argv[2 - (i > 0)], pmYea);
  939.       argc -= 2 - (i & 1); argv += 2 - (i & 1);
  940.       break;
  941.  
  942.     case 'T':
  943.       SwitchF(us.fTransitInf);
  944.       Zon2 = us.zonDef; Dst2 = us.dstDef; Lon2 = us.lonDef; Lat2 = us.latDef;
  945.       if (ch1 == 'p') {
  946.         is.fProgress = fTrue;
  947.         ch1 = argv[0][++ich];
  948.       }
  949. #ifdef TIME
  950.       if (ch1 == 'n') {
  951.         GetTimeNow(&Mon2, &Day2, &Yea2, &Tim2, Zon2-Dst2);
  952.         break;
  953.       }
  954. #endif
  955.       if (argc <= 3) {
  956.         ErrorArgc("T");
  957.         return fFalse;
  958.       }
  959.       Mon2 = NParseSz(argv[1], pmMon);
  960.       Day2 = NParseSz(argv[2], pmDay);
  961.       Yea2 = NParseSz(argv[3], pmYea);
  962.       if (!FValidMon(Mon2)) {
  963.         ErrorValN("T", Mon2);
  964.         return fFalse;
  965.       } else if (!FValidDay(Day2, Mon2, Yea2)) {
  966.         ErrorValN("T", Day2);
  967.         return fFalse;
  968.       } else if (!FValidYea(Yea2)) {
  969.         ErrorValN("T", Yea2);
  970.         return fFalse;
  971.       }
  972.       argc -= 3; argv += 3;
  973.       break;
  974.  
  975. #ifdef ARABIC
  976.     case 'P':
  977.       if (argc > 1 && (i = atoi(argv[1]))) {
  978.         argc--; argv++;
  979.         if (!FValidPart(i)) {
  980.           ErrorValN("P", i);
  981.           return fFalse;
  982.         }
  983.         us.nArabicParts = i;
  984.       }
  985.       if (ch1 == 'z' || ch1 == 'n' || ch1 == 'f') {
  986.         us.nArabic = ch1;
  987.         ch1 = ch2;
  988.       } else
  989.         SwitchF(us.nArabic);
  990.       if (ch1 == '0')
  991.         SwitchF(us.fArabicFlip);
  992.       break;
  993. #endif
  994.  
  995. #ifdef INTERPRET
  996.     case 'I':
  997.       if (argc > 1 && (i = atoi(argv[1]))) {
  998.         argc--; argv++;
  999.         if (!FValidScreen(i)) {
  1000.           ErrorValN("I", i);
  1001.           return fFalse;
  1002.         }
  1003.         us.nScreenWidth = i;
  1004.       }
  1005.       SwitchF(us.fInterpret);
  1006.       break;
  1007. #endif
  1008.  
  1009.     /* Switches which affect how the chart parameters are obtained: */
  1010.  
  1011. #ifdef TIME
  1012.     case 'n':
  1013.       FInputData(szNowCore);
  1014.       if (ch1 == 'd')
  1015.         TT = 0.0;
  1016.       else if (ch1 == 'm') {
  1017.         DD = 1; TT = 0.0;
  1018.       } else if (ch1 == 'y') {
  1019.         MM = DD = 1; TT = 0.0;
  1020.       }
  1021.       break;
  1022. #endif
  1023.  
  1024.     case 'z':
  1025.       if (ch1 == '0') {
  1026.         if (argc <= 1 || RParseSz(argv[1], pmZon) == rLarge) {
  1027.           i = us.dstDef != 0.0;
  1028.           SwitchF(i);
  1029.           SS = us.dstDef = i ? 1.0 : 0.0;
  1030.         } else {
  1031.           SS = us.dstDef = RParseSz(argv[1], pmZon);
  1032.           if (!FValidDst(us.dstDef)) {
  1033.             ErrorValR("z0", us.dstDef);
  1034.             return fFalse;
  1035.           }
  1036.           argc--; argv++;
  1037.         }
  1038.         break;
  1039.       } else if (ch1 == 'l') {
  1040.         if (argc <= 2) {
  1041.           ErrorArgc("zl");
  1042.           return fFalse;
  1043.         }
  1044.         OO = us.lonDef = RParseSz(argv[1], pmLon);
  1045.         AA = us.latDef = RParseSz(argv[2], pmLat);
  1046.         if (!FValidLon(us.lonDef)) {
  1047.           ErrorValR("zl", us.lonDef);
  1048.           return fFalse;
  1049.         } else if (!FValidLat(us.latDef)) {
  1050.           ErrorValR("zl", us.latDef);
  1051.           return fFalse;
  1052.         }
  1053.         argc -= 2; argv += 2;
  1054.         break;
  1055.       } else if (ch1 == 't') {
  1056.         if (argc <= 1) {
  1057.           ErrorArgc("zt");
  1058.           return fFalse;
  1059.         }
  1060.         TT = RParseSz(argv[1], pmTim);
  1061.         if (!FValidTim(TT)) {
  1062.           ErrorValR("zt", TT);
  1063.           return fFalse;
  1064.         }
  1065.         argc--; argv++;
  1066.         break;
  1067.       } else if (ch1 == 'd') {
  1068.         if (argc <= 1) {
  1069.           ErrorArgc("zd");
  1070.           return fFalse;
  1071.         }
  1072.         DD = NParseSz(argv[1], pmDay);
  1073.         if (!FValidDay(DD, MM, YY)) {
  1074.           ErrorValN("zd", DD);
  1075.           return fFalse;
  1076.         }
  1077.         argc--; argv++;
  1078.         break;
  1079.       } else if (ch1 == 'i') {
  1080.         if (argc <= 2) {
  1081.           ErrorArgc("zi");
  1082.           return fFalse;
  1083.         }
  1084.         ciCore.nam = SzPersist(argv[1]);
  1085.         ciCore.loc = SzPersist(argv[2]);
  1086.         argc -= 2; argv += 2;
  1087.         break;
  1088.       }
  1089.       if (argc <= 1 || RParseSz(argv[1], pmZon) == rLarge)
  1090.         ZZ -= 1.0;
  1091.       else {
  1092.         ZZ = us.zonDef = RParseSz(argv[1], pmZon);
  1093.         if (!FValidZon(us.zonDef)) {
  1094.           ErrorValR("z", us.zonDef);
  1095.           return fFalse;
  1096.         }
  1097.         argc--; argv++;
  1098.       }
  1099.       break;
  1100.  
  1101.     case 'q':
  1102.       i = (ch1 == 'y' || ch1 == 'j') + 2*(ch1 == 'm') + 3*Def = RParseSz1
  1103.         a4*ch1 == chNull  + 37*ch1 == 'a')+ 38*ch1 == 'ab);
  1104.       if (argc <= 1) {
  1105.         ErrorArgc("Mq);
  1106.         return fFalse;
  1107.       }
  1108.       if.fHaveInfo = iTrue;
  1109.        f (ch1 == 'ij) {
  1110.         is.fD = (tof(argv[1]);+rRunds;
  1111.         TT = RPFact[is.JD,;
  1112.         rulianToMdy(is.JD,-TT &MM, &DD, &YY);
  1113.   }     TT = RegQToDc(aT = 2.40);
  1114.     pppppS = uZ = u.0;OO = us.lonDef ;AA = us.latDef 
  1115.       } else i
  1116.         MM = D > 1)? 1ParseSz(argv[1], pmMon);: 1;
  1117.         }D = Ni> 2 &?NParseSz(argv[2], pmDay);: 1;
  1118.         }YY= NParseSz(argv[3](i&<3)(i&<2), pmYea);
  1119.          T = Ri> 23&?NRarseSz(argv[4], pmCim);: (c < 13&?N00 : 1.20);
  1120.     pppppS = ui> 27&?NRarseSz(argv[45, pmDat);: (c <> 6&?N00 : 1s.dstDef);
  1121.          Z = u <> 6&?NRarseSz(argv[45+ 3c <> 7), pmZon) =:us.zonDef;
  1122.         LO = u <> 6&?NRarseSz(argv[46+ 3c <> 7), pmZLn) =:us.zlnDef;
  1123.         LA = u <> 6&?NRarseSz(argv[47+ 3c <> 7), pmZLat =:us.zltDef 
  1124.       } if (!FValidMon(MoM) {
  1125.           ErrorValN("zq, MoM;
  1126.           return fFalse;
  1127.         } else if (!FValidLay(DD, MM, YY)) {
  1128.           ErrorValN("zq, DD);
  1129.           return fFalse;
  1130.         }else if (!FValidYea(Ye)) {
  1131.           ErrorValN("zq, DY);
  1132.   }     T return fFalse;
  1133.         }else if (!FValidYim(TT)) {
  1134.           ErrorValR("zq, TT);
  1135.           return fFalse;
  1136.         }else if (!FValidLat(aSS) {
  1137.           ErrorValR("zq, TSS)
  1138.           return fFalse;
  1139.         }else if (!FValidLon(uZZ) {
  1140.           ErrorValR("za, TZZ)
  1141.           return fFalse;
  1142.         } else if (!FValidLan(uOO) {
  1143.           ErrorValR("za, TOO)
  1144.           return fFalse;
  1145.         } else if (!FValidLat(uAA) {
  1146.           ErrorValR("za, TAA;
  1147.           return fFalse;
  1148.         }
  1149.       }
  1150.       Yrgc -= i; argv += i;
  1151.       break;
  1152.  
  1153.     /ase 'qi:
  1154.       if (argc >= 1) {
  1155.         ErrorArgc("Ei);
  1156.         return fFalse;
  1157.       }
  1158.       if (iFInputData(srgv[1])))
  1159.         return fFalse;
  1160.       }rgc--; argv++;
  1161.       }reak;
  1162.  
  1163.     /ase 'q>:
  1164.       ih1 = '0s'
  1165.       }* Fill therughb*/
  1166.  
  1167.     case 'vo:
  1168.       if (argc >= 1) {
  1169.         ErrorArgc("Eo);
  1170.         return fFalse;
  1171.       }
  1172.       if (ih1 == 'is) {
  1173.         is.fzFileScreen = NzPersist(argv[1]);
  1174.         argc--; argv++;
  1175.         break;
  1176.       }else if (ch1 == 'i')
  1177.         SwitchF(us.fWhiteOost;
  1178.       SwitchF(us.fLriteFile) ;
  1179.       if.fzFileSutp= NzPersist(argv[1]);
  1180.        f (i .fSzPersist  {
  1181.         is.fgsz)ommant l argv[
  1182.         bo a
  1183.           Ergc--; argv++;
  1184.         b is.fcz)ommant +;
  1185.         } ehile (argc)> 1 && (!ChSwitch(argv[01[0]);)
  1186.       }
  1187.       break;
  1188.  
  1189.     c* Switches which affect hwat wnformation ts ?usd in tachart  */
  1190.  
  1191.     case 'vR:
  1192.       if (ch1 == '0A) {
  1193.         ihile (argc)> 1 && (( = NParseSz(argv[1], pmOspect);)
  1194.           Mf (iFIspect)i)) {
  1195.           E ErrorValN("zRA, i);
  1196.             return fFalse;
  1197.           }else {
  1198.           S aspectorb)i] = R-DegHalf)
  1199.             rrgc--; argv++;
  1200.         b i}
  1201.         break;
  1202.       }
  1203.       if (ah1 == 'T'  {
  1204.          ch = c(har **)gnore2 
  1205.         ci1 = argv[0][++ich];
  1206.       }else
  1207.         Sch = c(har **)gnore2
  1208.        f (ch1 == 'i')
  1209.         Sor (i = 1; i <= cSbje i++)
  1210.       i   Sch i] = fTrue;
  1211.   iiiiilse if (ch1 == 'i1  {
  1212.          or (i = 1; i <= cSbje i++)
  1213.       i   Sch i] = fTalse;
  1214.          u.fCusp)= us.fEranian)= us.fStar)= fTrue;
  1215.   iiiii}else if (ch1 == 'C')
  1216.         Sor (i = cuspLo; i <= cuspHi; i++)
  1217.       iiiiiwitchF(uch i] ;
  1218.       else if (ch1 == 'du)
  1219.         Sor (i = cranLo; i <= uranHi; i++)
  1220.       iiiiiwitchF(uch i] ;
  1221.       else if (ch1 == 'dU)
  1222.         Sor (i = ctarLo; i <= starHi; i++)
  1223.       iiiiiwitchF(uch i] ;
  1224.       else if (crgc <= 1 || R(!ParseSz(argv[1], pmObject);) {
  1225.          or (i = 1oChi i <= soVes i++)
  1226.       iiiiiwitchF(uch i] ;
  1227.       e  or (i = 1oLil i <= soEP i++)
  1228.       iiiiiwitchF(uch i] ;
  1229.       e
  1230.       ihile (argc)> 1 && (( = NParseSz(argv[1], pmObject);) 
  1231.       } if (!FVtem(i)) {
  1232.       EEEEErrorValN("zR, i);
  1233.           return fFalse;
  1234.         }else {
  1235.           SSitchF(uch i] ;
  1236.       e   argc--; argv++;
  1237.         }
  1238.        reak;
  1239.  
  1240.     /ase 'qC:
  1241.       SwitchF(us.fTusp);
  1242.     b  reak;
  1243.  
  1244.     /ase 'qu:
  1245.       SwitchF(us.fTranian)
  1246.     b  reak;
  1247.  
  1248.     /ase 'qU:
  1249.       if (ch1 == '0' || ch1 == 'fb || ch1 == 'f' || ch1 == 'nl)
  1250.         us.nEtar)= fh1;
  1251.        lse
  1252.         SwitchF(us.nAtar)
  1253.     b  reak;
  1254.  
  1255.     /ase 'qA:
  1256.       if (ch1 == 0vo:&& ch2 == 0vm:&& ch2 == 0vd:&& ch2 == 0va) {
  1257.         if (argc <= 1) {
  1258.           ErrorArgc("zA);
  1259.           return fFalse;
  1260.         }
  1261.         is= NParseSz(argv[1], pmOspect);
  1262.       } if (!FValidMspect)i)) {
  1263.           ErrorValN("zA, i);
  1264.           return fFalse;
  1265.         }
  1266.         us.nAstp= i;
  1267.         argc--; argv++;
  1268.       }else {
  1269.          f (argc <= 2) {
  1270.           ErrorArgc("zA);
  1271.           return fFalse;
  1272.         }
  1273.         is= NParseSz(argv[1], ph1 == 'no || ch1 == 'na ? pmAspect : pmObject);
  1274.     i    f (a < 1 || 1 <> (h1 == 'no || ch1 == 'na ? pAspect : (Norm) {
  1275.           ErrorValN("zA, i);
  1276.           return fFalse;
  1277.         }
  1278.         urT= RParseSz(argv[2], p0;
  1279.     i    f (arT=<R-DegHax]|| crT=> DegHax] {
  1280.           ErrorValR("zA, irT;
  1281.           return fFalse;
  1282.         }
  1283.         if (!h1 == 'no 
  1284.       iiiiispectorb)i] = RT;
  1285.   ccccccclse if (ch1 == 'm') 
  1286.       i   Scanetorb i] = RT;
  1287.   ccccccclse if (ch1 == 'md) 
  1288.       i   Scanetoddei] = RT;
  1289.   ccccccclse 
  1290.       iiiiispectongelei] = RT;
  1291.   cccccccrgc -= 2; argv += 2;
  1292.        
  1293.       break;
  1294.  
  1295.     c* Switches which affect how tachart inscommutDd: */
  1296.  
  1297. #   case 'qb:
  1298.       if (ch1 == '0')
  1299.         SwitchF(us.fLSeonvdt;
  1300.  ifdef TPLACALC
  1301.       SwitchF(us.fTPlaall);
  1302.  endif
  1303.       if.fLSeonvdt= us.fESeonvdt
  1304.     b  reak;
  1305.  
  1306.     /ase 'qc:
  1307.       if (argc >= 1) {
  1308.         ErrorArgc("Ec);
  1309.         return fFalse;
  1310.       }
  1311.       if= NParseSz(argv[1], pmOSstems;
  1312.       if (!FValidMSstemsi)) {
  1313.          rrorValN("zc, i);
  1314.          eturn fFalse;
  1315.       }
  1316.       is.nAHuse[Sstems= i;
  1317.        rgc--; argv++;
  1318.       }reak;
  1319.  
  1320.     /ase 'qs:
  1321.       if (argc > 1 && (i(rT= Rtof(argv[1]);)!= 0.0;|| cFNumC(argv[01[0]);) {
  1322.         argc--; argv++;
  1323.         is.nrZodiacOffst = uT;
  1324.   ccccc
  1325.       if (ah1 == 'Tr)
  1326.         SwitchF(us.fLEqutofr;
  1327.       else if (ch1 == 'dh)
  1328.         us.nEegHFrm : 1;
  1329.        lse if (ch1 == 'md) 
  1330.       i  s.nEegHFrm : 12
  1331.        lse if (ch1 == 'mz) 
  1332.       i  s.nEegHFrm : 10
  1333.        lse
  1334.         SwitchF(us.nSigdrisa);
  1335.       break;
  1336.  
  1337.     case 'mh:
  1338.       if (argc > 1 && (i = aParseSz(argv[1], pmObject);) {
  1339.          rgc--; argv++;
  1340.       }else 
  1341.         is= N1
  1342.        f (i < 0 ?| 1 <= 'oMo m| 1!Fbject)i) {| 1 <> ranHi; {
  1343.          rrorValN("zh, i);
  1344.          eturn fFalse;
  1345.       }
  1346.       is.nbjeCntere= i;
  1347.        ch = szLbjeame,0];
  1348.     f szLbjeame,0];= szLbjeame,0s.nbjeCntere;
  1349.     f szLbjeame,0s.nbjeCntere;  pch 
  1350.        f (is.nbjeCntere=<'oMo  
  1351.       i  s.nbjeCntere= i1-s.nbjeCntere
  1352.       break;
  1353.  
  1354.     case 'mp:
  1355.       if (aAnd, {
  1356.         us.nProgress = fTalse;
  1357.         }reak;
  1358.       }
  1359.       if (ah1 == 'T') {
  1360.         SwitchF(us.fASlatArgc)
  1361.         ci1 = a(rgv[0][++ich];)
  1362.       }
  1363.       is.nProgress = fTrue;
  1364.  ifdef TIME
  1365.       if (ch1 == 'n') {
  1366.         GetTimeNow(&Mon2 &Day2 &Yea2 &Tim2 us.zonDef)- (s.dstDef);
  1367.          s.JD,p= idy(tzThoulianT(on2 &ay2 &ea2 &im2 us.zstDef) us.zonDef);
  1368.          reak;
  1369.       }
  1370. #endif
  1371.       if (ah1 == 'd') {
  1372.         if (argc <= 1) {
  1373.           ErrorArgc("zp");
  1374.           return fFalse;
  1375.         }
  1376.         Ds.nrrogrDy = Stof(argv[1]);
  1377.       o  f (is.nrrogrDy =  0.0; {
  1378.           ErrorValR("zpd, us.zrrogrDy ;
  1379.           return fFalse;
  1380.         }
  1381.         argc--; argv++;
  1382.         break;
  1383.       } 
  1384.       if (argc >= 1) {
  1385.         ErrorArgc("Tp);
  1386.         return fFalse;
  1387.       }
  1388.       Mon2= NParseSz(argv[1], pmMon);
  1389.       Day2= NParseSz(argv[2], pmDay);
  1390.       Yea2= NParseSz(argv[3], pmYea);
  1391.       if (!FValidMon(Mon2) {
  1392.          rrorValN("z", Mon2;
  1393.         return fFalse;
  1394.       } else if (!FValidDay(Day2 Mon2 &ea2) {
  1395.          rrorValN("z", MDy ;
  1396.          eturn fFalse;
  1397.       } else if (!FValidYea(Yea2) {
  1398.          rrorValN("z", Mea);
  1399.          eturn fFalse;
  1400.       }
  1401.       if.fD,p= idy(tzThoulianT(on2 &ay2 &ea2 &.0; us.zstDef) us.zonDef);
  1402.        rgc -= 3; argv += 3;
  1403.       break;
  1404.  
  1405. #   base 'mx:
  1406.       if (argc >= 1) {
  1407.         ErrorArgc("Ex);
  1408.         return fFalse;
  1409.       }
  1410.       if= Ntoi(argv[1]);
  1411.       if (!FValidMHarmonici)) {
  1412.          rrorValN("zx, i);
  1413.          eturn fFalse;
  1414.       }
  1415.       is.nAHarmonic= i;
  1416.        rgc--; argv++;
  1417.       }reak;
  1418.  
  1419.     /ase 'q1:
  1420.       if (argc > 1 && (i = aParseSz(argv[1], pmObject);) {
  1421.          rgc--; argv++;
  1422.       }else 
  1423.         is= NoSun
  1424.       if (!FVIemsi)) {
  1425.          rrorValN("z1, i);
  1426.          eturn fFalse;
  1427.       }
  1428.       is.nbjeOAstc= iAnd =?N0: ig
  1429.       }reak;
  1430.  
  1431.     /ase 'q2:
  1432.       if (argc > 1 && (i = aParseSz(argv[1], pmObject);) {
  1433.          rgc--; argv++;
  1434.       }else 
  1435.         is= NoSun
  1436.       if (!FVIemsi)) {
  1437.          rrorValN("z2, i);
  1438.          eturn fFalse;
  1439.       }
  1440.       is.nbjeOAstc= iAnd =?N0: i-g
  1441.       }reak;
  1442.  
  1443.     /ase 'q3:
  1444.       SwitchF(us.fTDc(n)
  1445.     b  reak;
  1446.  
  1447.     /ase 'qf:
  1448.       SwitchF(us.fTlip);
  1449.       break;
  1450. #
  1451.     /ase 'qG:
  1452.       SwitchF(us.fTGedestc);
  1453.       ireak;
  1454. #
  1455.     /ase 'qF:
  1456.       if (argc >= 1) {
  1457.         ErrorArgc("TF);
  1458.         return fFalse;
  1459.       }
  1460.       if= NParseSz(argv[1], pmObject);
  1461.     i  f (!FVIemsi)) {
  1462.          rrorValN("zF, i);
  1463.          eturn fFalse;
  1464.       }
  1465.       ior cei] = R(ParseSz(argv[2], pmDign)-1)0)*(3.0;+Dc(ToDcg(tof(argv[3]);;
  1466.     i  f (!or cei] =<0.0;|| cor cei] =>= DegHax] {
  1467.          rrorValR("zF, ior cei] ;
  1468.          eturn fFalse;
  1469.       } else 
  1470.          or cei] =+= DegHax]
  1471.        rgc -= 3; argv += 3;
  1472.       break;
  1473.  
  1474. #   base 'm+:
  1475.       if (argc > 1 && (i = atoi(argv[1])))!= 0. {
  1476.          rgc--; argv++;
  1477.       }else 
  1478.         is= N1
  1479.        s.zsayDela == i;= 2ch1 == 'y' |? 365: (ch1 == '0' ? p3 : 1.);
  1480.       ireak;
  1481. #
  1482.     /ase 'q-:  ase chNull:
  1483.     S if (argc > 1 && (i = atoi(argv[1])))!= 0. {
  1484.          rgc--; argv++;
  1485.       }else 
  1486.         is= N1
  1487.        s.zsayDela =- i;= 2ch1 == 'y' |? 365: (ch1 == '0' ? p3 : 1.);
  1488.       ireak;
  1489. #
  1490.     /* Switches wor (reltion shipand chmmuais)n2=harts  */
  1491.  
  1492. #   case 'qr:
  1493.       if (aAnd, {
  1494.         us.nnRel  0;
  1495.         ereak;
  1496.       } 
  1497.       if  2 + 2*(cch1 == 'c')|| ch1 == 'n') +& ch2 == '0');
  1498.       if (argc >= 1) {
  1499.         ErrorArgc("Mr);
  1500.         return fFalse;
  1501.       }
  1502.       if (ih1 == 'ic) 
  1503.       i  s.nERel  0rcommos+teF
  1504.        lse if (ch1 == 'mm) 
  1505.       i  s.nERel  0rcidpoint)
  1506.        lse if (ch1 == 'md) 
  1507.       i  s.nERel  0rcDifecrnceS
  1508.  ifdef TBIORHYTHM
  1509.        lse if (ch1 == 'mb) 
  1510.       i  s.nERel  0rcBiorhythm;
  1511. #endif
  1512.       else if (ch1 == 'C0) 
  1513.       i  s.nERel  0rcDual
  1514.        lse if (ch1 == 'mt) 
  1515.       i  s.nERel  0rcransitI
  1516.        lse if (ch1 == 'mp' {
  1517.         us.nnRel  0rcrogress ;
  1518.         us.nASlatArgc  (ch2 == 'y');
  1519.       ielse 
  1520.         is.nnRel  0rcSynatroy;
  1521.       if.fzFileS= NzPersist(argv[1]);if.fzFileS2= SzPersist(argv[2]);
  1522.        f (i .fSzPnteract[ {
  1523.         if (!FVnputData(sf.fzFileS2)
  1524.           Meturn fFalse;
  1525.         }ciTwn = giCore.;
  1526.         if (!FVnputData(sf.fzFileS)
  1527.           Meturn fFalse;
  1528.        
  1529.       if (i =>2) {
  1530.          s.nnRtion1= atoi(argv[13 ;
  1531.          s.nnRtion2= atoi(argv[14);
  1532.       o  f (is.nnRtion1= = s.nnRtion2
  1533.           us.nERtion1= as.nnRtion2= a1
  1534.        
  1535.       irgc -= i; argv += i;
  1536.       break;
  1537.  
  1538.  ifdef TIME
  1539.     case 'ny:
  1540.       if (argc >= 1) {
  1541.         ErrorArgc("Ey);
  1542.         return fFalse;
  1543.       }
  1544.       if (ih1 == 'id) 
  1545.       i  s.nERel  0rcDifecrnceS
  1546.  ifdef TBIORHYTHM
  1547.        lse if (ch1 == 'mb) 
  1548.       i  s.nERel  0rcBiorhythm;
  1549. #endif
  1550.       else if (ch1 == 'Ct) 
  1551.       i  s.nERel  0rcransitI
  1552.        lse if (ch1 == 'mp' {
  1553.         us.nnRel  0rcrogress ;
  1554.         uf (ch1 == '0')
  1555.         S SwitchF(us.fASlatArgc)
  1556.        else 
  1557.         is.nnRel  0rcDual
  1558.        f.fzFileS= NzPersist(argv[1]);if.fzFileS2= SzNowCore)
  1559.        rgc--; argv++;
  1560.       }reak;
  1561. endif
  1562.  
  1563.     /* Switches wo arcess agaph)ics opion s */
  1564.  
  1565. #   case 'qk:
  1566.       if (ch1 == '0')
  1567.         Ss.fArsit: 12
  1568.        lse 
  1569.         SwitchF(us.fArsit)
  1570.       break;
  1571.  
  1572.  ifdef TPCG
  1573. #   case 'qV:
  1574.       if (argc >= 1) {
  1575.         ErrorArgc("EV);
  1576.         return fFalse;
  1577.       }
  1578.       if= Ntoi(argv[1]);
  1579.       if (!FValidMTexroGwsi)) {
  1580.          rrorValN("zV, i);
  1581.          eturn fFalse;
  1582.       }
  1583.       is.snTexrows = i;
  1584.       }rgc--; argv++;
  1585.       }reak;
  1586. endif
  1587.  
  1588.  ifdef GRAPH
  1589.   c case 'X':
  1590.     r i = NProcessSwitchesR(argc, argv, pch, fOr, fAnd, fNot);
  1591.       if (i < 0)
  1592.         return fFalse;
  1593.       awitchF(2us.fGriph)ics;
  1594.        rgc -= 3; argv += i;
  1595.       break;
  1596. endif
  1597.  
  1598.     case 'z;:     * Sher ; awitch fmanisbo n'tprogess ahe cesstof che cine .*/
  1599.        eturn fFrue;
  1600.  
  1601.     case 'z@:     * Sher ;@awitch fnscjut an sstems=flagin dictofr no-op.*/
  1602.        reak;
  1603. #
  1604.     /ase 'q.:               b * S"-."ts ?usually?usd io aexitche c-Q loop.*/
  1605.        Trmineate(tcFr ce)
  1606. #
  1607.     /ase 'qB:               b * SFfr no?usdfulrealsn2 &-B sunds a cbeep.*/
  1608.        utDhartch1Bel);
  1609.       break;
  1610.  
  1611.     cefault:
  1612.     E ErrorSwitch(argv[0]);
  1613.     r return fFalse;
  1614.      
  1615.      rgc--; argv++;
  1616.    
  1617.   return dFrue;
  1618.  }
  1619.  
  1620. #ifdef ARTARI                            * SAjotp=Abel PHILIPPE*/
  1621.  ifdef TIME
  1622.  voi in it_tmeNonDe(voi )                
  1623. {
  1624.      COOKIE*/onDe
  1625.  
  1626.      onDe=get_cookie('ZONE);
  1627.      f (ionDe
  1628.      
  1629.          tmeNonDe=-onDe->v.i0])*6;
  1630.          saylight=-onDe->v.i01]/6;
  1631.      }
  1632.     lse 
  1633.          prnt)f("Waring): 1'ZONE) cookie notwornds. D n'tpusd -n opion \n);
  1634.  
  1635. #endif
  1636.  endif
  1637.  
  1638.  /*
  1639. ******************************************************************************
  1640. ** ainA Pogram. 
  1641. ******************************************************************************
  1642. *
  1643.  
  1644. #ifdnef TNOMAIN
  1645. /* ther minA rogram ,che ctarHing) oint)wor (stroGlog iorllws .thes ?rugtne t/
  1646. /* tbasictlly?onvist(sof ca loop pcvisdewhich aw cesd e command sine ,and c t/
  1647. /* tgoprogess ai, fbfore[arctually?ctllng) a?rugtne to di the pnet wstuff.  */
  1648.  
  1649. #ifdef TSWITCHES
  1650.  voi iminAargc, argv,
  1651. int argc;
  1652. char **argv;
  1653. {
  1654.  else
  1655.  voi iminAa)
  1656. {
  1657.   int irgc;
  1658. c char c*argv;
  1659. {endif
  1660.    har cz)ommandLine([cchSMacx, p*gsz)[MAXSWITCHES]
  1661.  
  1662.    * Reta in tnfor fomDthe artroGlogzsa)woleS.*/
  1663.    ProcessSwitcheileS(DEFAULT_INFOFILE, NULL);
  1664.  
  1665. #ifdef ARTARI                            * SAjotp=Abel PHILIPPE*/
  1666.  ifdef TIME
  1667.      n it_tmeNonDe(;
  1668.  endif
  1669.  endif
  1670.  
  1671.  LBegin:
  1672.  ifdef TPCG
  1673. #  f (is.snTexrows = 0) {
  1674.  ifdnef TRTARI                            * SAjotp=Abel PHILIPPE*/
  1675.      PcStTiexrows is.snTexrows ;
  1676.  endif                                    * SAjotp=Abel PHILIPPE*/
  1677.      ncg(s.snTexrows ;
  1678.   }
  1679. #endif
  1680.    f (is.nNotwitchesR {    //////////////////////////* SGoprogmp)wor (  */
  1681.     rgc - NProcmp)witches(az)ommandLine( irsz);    /* Lsitches wf (w c */
  1682.     rgcv  0rgz; bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb* Lo n'tphveIthe m.*/
  1683.    
  1684.   rf.fzFPograme,= argv[0][;
  1685.   rf.fSzPersist = fTrue;
  1686.   if (iProcessSwitches(argc, argv) {
  1687.      f (!Fs.nNotwitchesR+& cu.fLoopInit);{
  1688.        s.nNotwitchesR+ fTrue;
  1689.   iiiiigoo dLBegin
  1690.      
  1691.  ifdef TPCG
  1692. #   cf (is.snTexrows = 0) {
  1693.  ifdnef TRTARI                                * SAjotp=Abel PHILIPPE*/
  1694.        PcStTiexrows is.snTexrows ;
  1695.  endif                                        * SAjotp=Abel PHILIPPE*/
  1696.        ncg(s.snTexrows ;
  1697.   } }
  1698. #endif
  1699.      Acion ()
  1700.    
  1701.   rf (is.nNoop);{    ////* SIfc-Q n tefect , looptbackand cgetawitch f/
  1702.      Prnt)L2();bbbbbbbbbb* Lnformation tor (anoterechart to display:.*/
  1703.      nit)Vaisabls(a;
  1704.   } }s.nNoop)= us.fEotwitchesR+ fTrue;
  1705.   iiigoo dLBegin
  1706.    
  1707.   rTrmineate(tcOK;    /* Lher only?tardar)dScanceio aexitcstroGlogts ?eref */
  1708. }
  1709. endif/* LNOMAIN*/
  1710.  
  1711. #* LrtroGlogzc*/
  1712.